/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package presentacion.recursos;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Manuelita
 */
public class MiRender extends DefaultTableCellRenderer {
    @Override
    public Component getTableCellRendererComponent(JTable tabla, Object valor, boolean seleccionado, boolean hasfocus, int fila, int columna){
        setEnabled(tabla == null || tabla.isEnabled());
        String value = tabla.getValueAt(fila, 2).toString();
        if(value.equals("En Uso")){
            setBackground(Color.BLUE);
            setForeground(Color.white);
        }else if(value.equals("Reparacion") || value.equals("Prestamo") || value.equals("Otro")){
            setBackground(Color.RED);
            setForeground(Color.white);
        }else{
            setBackground(Color.lightGray);
            setForeground(Color.black);
        }
        super.getTableCellRendererComponent(tabla, valor, seleccionado, hasfocus, fila, columna);
        return this;
    }
}
